<script>
import OutboundRecordPickingAuditForm from './OutboundRecordPickingAuditForm.vue'

export default {
  name: 'OutboundRecordPickingAuditModal',
  components: {
    OutboundRecordPickingAuditForm
  },
  data() {
    return {
      title: '',
      width: 800,
      visible: false,
      disableSubmit: false,
    }
  },
  methods: {
    audit(record) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realAuditForm.audit(record)
      })
    },
    auditPass() {
      this.$refs.realAuditForm.handleSubmit()
    },
    auditReject() {
      this.$refs.realAuditForm.auditReject()
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    },
    close() {
      this.$emit('close')
      this.visible = false
    }
  }
}
</script>

<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    fullscreen
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <outbound-record-picking-audit-form
      ref="realAuditForm"
      :disabled="disableSubmit"
      @ok="submitCallback" />
    <template #footer>
      <a-button key="back" @click="handleCancel">取消</a-button>
      <a-popconfirm title="确定驳回吗?" @confirm="() => auditReject()">
        <a-button v-if="!disableSubmit" type="danger">驳回</a-button>
      </a-popconfirm>
      <a-button v-if="!disableSubmit" type="primary" @click="auditPass">通过</a-button>
    </template>
  </j-modal>
</template>

<style scoped>

</style>